nlp_architect.models.absa package

Submodules

nlp_architect.models.absa.utils module

nlp_architect.models.absa.utils.load_opinion_lex(file_name: Union[str, os.PathLike]) → dict[source]

Read opinion lexicon from CSV file.

Returns:Dictionary of LexiconElements, each LexiconElement presents a row.
nlp_architect.models.absa.utils.parse_dir(parser, input_dir: Union[str, os.PathLike], out_dir: Union[str, os.PathLike] = None, show_tok=True, show_doc=True)[source]

Parse a directory of raw text documents, one by one.

Parameters:
  • parser (SpacyBISTParser) –
  • input_dir (str or PathLike) –
  • out_dir (str or PathLike) – If specified, the output will also be written to this path.
  • show_tok (bool, optional) – Specifies whether to include token text in output.
  • show_doc (bool, optional) – Specifies whether to include document text in output.
Yields:

CoreNLPDoc – the annotated document.

nlp_architect.models.absa.utils.parse_docs(parser: nlp_architect.pipelines.spacy_bist.SpacyBISTParser, docs: Union[str, os.PathLike], out_dir: Union[str, os.PathLike] = None, show_tok=True, show_doc=True)[source]

Parse raw documents in the form of text files in a directory or lines in a text file.

Parameters:
  • parser (SpacyBISTParser) –
  • docs (str or PathLike) –
  • out_dir (str or PathLike) – If specified, the output will also be written to this path.
  • show_tok (bool, optional) – Specifies whether to include token text in output.
  • show_doc (bool, optional) – Specifies whether to include document text in output.
Returns:

(list of CoreNLPDoc)

nlp_architect.models.absa.utils.parse_txt(parser: nlp_architect.pipelines.spacy_bist.SpacyBISTParser, txt_path: Union[str, os.PathLike], out_dir: Union[str, os.PathLike] = None, show_tok=True, show_doc=True)[source]

Parse raw documents in the form of lines in a text file.

Parameters:
  • parser (SpacyBISTParser) –
  • txt_path (str or PathLike) –
  • out_dir (str or PathLike) – If specified, the output will also be written to this path.
  • show_tok (bool, optional) – Specifies whether to include token text in output.
  • show_doc (bool, optional) – Specifies whether to include document text in output.
Yields:

CoreNLPDoc – the annotated document.

nlp_architect.models.absa.utils.read_generic_lex_from_file(file_name: Union[str, os.PathLike])[source]

Read generic opinion lex for term acquisition.

Parameters:file_name (str or PathLike) – name of csv file

Module contents